import 'package:flutter/material.dart';

class ToolipPage extends StatefulWidget {
  const ToolipPage({Key? key}) : super(key: key);

  @override
  State<ToolipPage> createState() => _ToolipPageState();
}

class _ToolipPageState extends State<ToolipPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(" Tooltip 小提示组件 长按显示 有振动触觉"),
    ),
    body: Container(
      width: MediaQuery.of(context).size.width,
      height: double.infinity,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Tooltip(
            message: "小提示",
            // true 显示在下面 false 显示在上面
            preferBelow: true,
            // 显示时间
            showDuration: Duration(seconds: 3),
            // 垂直偏移
            verticalOffset: 10.0,
            decoration: BoxDecoration(
              border: Border.all(color: Colors.red),
              color: Colors.grey
            ),
            textStyle: TextStyle(color: Colors.blue),
            child: ElevatedButton(
              onPressed: (){}, 
              child: Text("想一想")
              ),
          )
        ],
      ),
    ),
    );
  }
}